Crate ntest

source · []
Expand description

The ntest lib enhances the rust test framework with some useful functions.

Re-exports

pub extern crate ntest_proc_macro_helper;

Macros

Compare floating point values or vectors of floating points wether they are approximately equal. The default value for epsilon is 1.0e-6.

Expects a false expression. Otherwise panics.

A panic in Rust is not always implemented via unwinding, but can be implemented by aborting the process as well. This function only catches unwinding panics, not those that abort the process. See the catch unwind documentation for more information.

Expects a true expression. Otherwise panics.

Traits

Helper trait for assert_about_equal macro. Returns the max difference between two vectors of floats. Can also be used for single floats.

Attribute Macros

Test cases can be used to have multiple inputs for a given function. With the #[test_case] attribute multiple tests will be generated using the Procedural Macros capabilities of rust.

The timeout attribute can be used for tests to let them fail if they exceed a certain execution time. With the #[timeout] attribute a timeout in milliseconds is added to a test.